import {
	request
} from './request.js'

// 增加新用户
export const addUser = (data) => {
	return request({
		url: '/api/user',
		method: 'POST',
		data
	})
}

// 查询用户信息
export const getUser = (openid) => {
	return request({
		url: `/api/user?openid=${openid}`,
		method: 'GET',
	})
}

// 更新用户信息-头像,昵称
export const updateUser = (openid, data) => {
	return request({
		url: `/api/user/${openid}`,
		method: 'PATCH',
		data
	})
}

// ---------------转盘----------------------------

//  新增转盘
export const addTurn = (data) => {
	return request({
		url: '/api/turntable',
		method: 'POST',
		data
	})
}

// 获取个人转盘数据
export const getTrunTable = (openid) => {
	return request({
		url: `/api/turntable/${openid}`,
		method: 'GET',
	})
}

//  删除转盘
export const delTurn = (id) => {
	return request({
		url: `/api/turntable/${id}`,
		method: 'DELETE'
	})
}
//  编辑转盘
export const editTurn = (id,data) => {
	return request({
		url: `/api/turntable/${id}`,
		method: 'PATCH',
		data
	})
}